<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/conformanceFunction.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:fcn="http://xbrl.org/2008/function"
  xmlns:cfcn="http://xbrl.org/2008/conformance/function"
  xmlns:xbrli="http://www.xbrl.org/2003/instance"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xqt-err="http://www.w3.org/2005/xqt-errors"
  xmlns:concept="http://xbrl.org/formula/conformance/example" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  http://xbrl.org/2008/conformance ../schemas/conformance.xsd
  http://xbrl.org/2008/conformance/function ../schemas/conformanceFunction.xsd
  ">
  <owners>
    <reg:owner id="herm">
      <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
      <reg:email>fischer@markv.com</reg:email>
     <reg:assumedOwnership moment="2008-12-12T00:00:00" />
    </reg:owner>
  </owners>

  <number>90505</number>

  <name>Function test for xfi:role-definition</name>

  <documentation>
    <xhtml:p>
      Tests of function xfi:role-definition($arcrole as xs:string, element(xbrli:xbrl)?) as xs:string?
      </xhtml:p>
  </documentation>

  <reference xlink:type="simple" xlink:href="http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm#_Toc152670666"/>

  <variation id="V-01">
    <name>Definition of role link1</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V01" xlink:type="simple" xlink:href="definition-test1.xsd"/>
     <cfcn:call file="V01">
        xfi:role-definition('http://abc.com/role/link1')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq 'Hello from link1'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-02">
    <name>Definition of role link2</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V02" xlink:type="simple" xlink:href="definition-test1.xsd"/>
     <cfcn:call file="V02">
        xfi:role-definition('http://abc.com/role/link2')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result eq 'Hello from link2'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03">
    <name>Definition absent from role link3</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V03" xlink:type="simple" xlink:href="definition-test1.xsd"/>
     <cfcn:call file="V03">
        xfi:role-definition('http://abc.com/role/link3')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         empty($result)
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-04">
    <name>Definition of non-existent role link4</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
      
    <inputs>
      <schema readMeFirst="true" id="V04" xlink:type="simple" xlink:href="definition-test1.xsd"/>
     <cfcn:call file="V04">
        xfi:role-definition('http://abc.com/role/link4')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         empty($result)
      </cfcn:test>
    </outputs>
  </variation>


  <revisions>
    <reg:revision on="2008-12-12T00:00:00" by="herm">
      <xhtml:p>
        Created the test case.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2010-09-09T00:00:00" by="herm">
      <xhtml:p>
        Changed role URI to string for cast-less coding and to be similar to fn:QName's $paramURI, an xs:string.
      </xhtml:p>
    </reg:revision>
  </revisions>

</testcase>




